import requests
from bs4 import BeautifulSoup
header={'User-Agent': 'Mozilla/5.0'}
re=requests.get('https://xiaoshuo.sogou.com/top/',headers=header)
re.encoding = 'utf-8'
# print(re.status_code)
# print(re.text)
#print(re.encoding)
#print(re.apparent_encoding)
nos=[]
title=["电影榜单","电视剧","动漫",'综艺']
host=[]
name=[]
soup=BeautifulSoup(re.text,'html.parser')
for li in soup.findAll(name="a",attrs={"class":"top-detail"}):
#    print(li.text)
# #    print ( li.contents )
    nos.append(li.contents[-2].string)
    host.append(li.contents[3].string)
    name.append(li.contents[5].string)
print(host)
print(name)
print(nos)
